[LaTeX] 关于图片/表格并排

新博客的第一篇文章,写一点比较有意义的。对于大多数刚接触[latex]\LaTeX[/latex]的同学来说,插入图片是最痛苦的。 大小,位置,文字环绕,如果你仅仅凭自己摸索的话, 个把小时也不会有什么结果。 这也是我创建这个博客的最初想法,相比于其他的语言,LaTeX 实在是太依赖一个可靠的框架了。好了,废话不多说,进入正题。
目前图片并排最可靠的解决方法是minipage,

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
\documentclass[letterpaper,10pt]{article}
\usepackage{graphicx}

\begin{document}
\begin{minipage}{\textwidth}
\begin{minipage}[h]{0.5\textwidth}
\centering
\includegraphics[height=0.7\textwidth]{a.png}
\makeatletter\def\@captype{figure}\makeatother\caption{}
\label{a}
\end{minipage}
\begin{minipage}[h]{0.5\textwidth}
\centering
\includegraphics[height=0.7\textwidth]{b.png}
\makeatletter\def\@captype{figure}\makeatother\caption{}
\label{b}
\end{minipage}
\end{minipage}
\end{document}

注意, 如果把 \@captype{figure} 改为 table 并且替换 \includgraphics 就能轻松做到图片-表格并列或者表格-表格并列。